home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / TextServices.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  13.8 KB  |  329 lines  |  [TEXT/MPS ]

  1. (*
  2.      File:        TextServices.mod
  3.  
  4.      Contains:    Text Services Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs.applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. *)
  19.  
  20. (*$TAGS-*)
  21. (*$CALLING PASCAL*)
  22. MODULE TextServices;
  23.  
  24. IMPORT SYSTEM, Types, Quickdraw, Events, Menus, AppleEvents, Components;
  25.  
  26. (* $PUSH*)
  27. (* $ALIGN MAC68K*)
  28. (* $LibExport+*)
  29.  
  30. CONST
  31.     kTSMVersion*                    = $200;                            (* Version of the Text Services Manager is 2.0  *)
  32.     kTextService*                = LONG("tsvc");                        (* component type for the component description *)
  33.     kInputMethodService*            = LONG("inpm");                        (* component subtype for the component description *)
  34. (* Components.Component Flags in Components.ComponentDescription *)
  35.     bTakeActiveEvent*            = 15;                            (* bit set if the component takes active event *)
  36.     bHandleAERecording*            = 16;                            (* bit set if the component takes care of recording Apple Events <new in vers2.0> *)
  37.     bScriptMask*                    = $00007F00;                    (* bit 8 - 14 *)
  38.     bLanguageMask*                = $000000FF;                    (* bit 0 - 7  *)
  39.     bScriptLanguageMask*            = bScriptMask + bLanguageMask;    (* bit 0 - 14  *)
  40.  
  41. (* Hilite styles *)
  42.     kCaretPosition*                = 1;                            (* specify caret position *)
  43.     kRawText*                    = 2;                            (* specify range of raw text *)
  44.     kSelectedRawText*            = 3;                            (* specify range of selected raw text *)
  45.     kConvertedText*                = 4;                            (* specify range of converted text *)
  46.     kSelectedConvertedText*        = 5;                            (* specify range of selected converted text *)
  47.  
  48. (* Apple Event constants *)
  49. (* Event class *)
  50.     kTextServiceClass*            = kTextService;
  51. (* event AIFF.ID *)
  52.     kUpdateActiveInputArea*        = LONG("updt");                        (* update the active Inline area *)
  53.     kPos2Offset*                    = LONG("p2st");                        (* converting global coordinates to char position *)
  54.     kOffset2Pos*                    = LONG("st2p");                        (* converting char position to global coordinates *)
  55.     kShowHideInputWindow*        = LONG("shiw");                        (* show or hide the input window *)
  56. (* Event keywords *)
  57.     keyAETSMDocumentRefcon*        = LONG("refc");                        (* TSM document refcon, typeLongInteger *)
  58. (* Note: keyAETSMScriptTag, keyAERequestedType, keyAETSMTextFont, keyAETextPointSize
  59.     typeAEText, typeIntlWritingCode, typeQDPoint, and keyAEAngle have been moved to 
  60.     AERegistry.h *)
  61.     keyAEServerInstance*            = LONG("srvi");                        (* component instance *)
  62.     keyAETheData*                = LONG("kdat");                        (* typeText *)
  63.     keyAEFixLength*                = LONG("fixl");                        (* fix len ?? *)
  64.     keyAEHiliteRange*            = LONG("hrng");                        (* hilite range array *)
  65.     keyAEUpdateRange*            = LONG("udng");                        (* update range array *)
  66.     keyAEClauseOffsets*            = LONG("clau");                        (* Clause Offsets array *)
  67.     keyAECurrentPoint*            = LONG("cpos");                        (* current point *)
  68.     keyAEDragging*                = LONG("bool");                        (* dragging falg *)
  69.     keyAEOffset*                    = LONG("ofst");                        (* offset *)
  70.     keyAERegionClass*            = LONG("rgnc");                        (* region class *)
  71.     keyAEPoint*                    = LONG("gpos");                        (* current point *)
  72.     keyAEBufferSize*                = LONG("buff");                        (* buffer size to get the text *)
  73.     keyAEMoveView*                = LONG("mvvw");                        (* move view flag *)
  74.     keyAELength*                    = LONG("leng");                        (* length *)
  75.     keyAENextBody*                = LONG("nxbd");                        (* next or previous body *)
  76. (* optional keywords for Offset2Pos (Info about the active input area) *)
  77.     keyAETextLineHeight*            = LONG("ktlh");                        (* typeShortInteger *)
  78.     keyAETextLineAscent*            = LONG("ktas");                        (* typeShortInteger *)
  79. (* optional keywords for Pos2Offset *)
  80.     keyAELeftSide*                = LONG("klef");                        (* type Boolean *)
  81. (* optional keywords for kShowHideInputWindow *)
  82.     keyAEShowHideInputWindow*    = LONG("shiw");                        (* type Boolean *)
  83. (* for PinRange  *)
  84.     keyAEPinRange*                = LONG("pnrg");
  85. (* Desc type ... *)
  86.     typeComponentInstance*        = LONG("cmpi");                        (* server instance *)
  87.     typeTextRangeArray*            = LONG("tray");                        (* text range array *)
  88.     typeOffsetArray*                = LONG("ofay");                        (* offset array *)
  89.     typeText*                    = AppleEvents.typeChar;                        (* Plain text *)
  90.     typeTextRange*                = LONG("txrn");
  91.  
  92. (* Desc type constants *)
  93.     kTSMOutsideOfBody*            = 1;
  94.     kTSMInsideOfBody*            = 2;
  95.     kTSMInsideOfActiveInputArea*    = 3;
  96.  
  97.     kNextBody*                    = 1;
  98.     kPreviousBody*                = 2;
  99.  
  100. (* typeTextRange         LONG("txrn") *)
  101.  
  102. TYPE
  103.     TextRange* = RECORD
  104.         fStart*:                    LONGINT;
  105.         fEnd*:                    LONGINT;
  106.         fHiliteStyle*:            INTEGER;
  107.     END;
  108.  
  109.     TextRangePtr* = POINTER TO TextRange;
  110.  
  111.     TextRangeHandle* = HANDLE TO TextRange (*ΔΔ POINTER TO TextRangePtr*);
  112.  
  113. (* typeTextRangeArray    LONG("txra") *)
  114.     TextRangeArray* = RECORD
  115.         fNumOfRanges*:            INTEGER;                                (* specify the size of the fRange array *)
  116.         fRange*:                    ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF TextRange;                (* when fNumOfRanges > 1, the size of this array has to be calculated *)
  117.     END;
  118.  
  119.     TextRangeArrayPtr* = POINTER TO TextRangeArray;
  120.  
  121.     TextRangeArrayHandle* = HANDLE TO TextRangeArray (*ΔΔ POINTER TO TextRangeArrayPtr*);
  122.  
  123. (* typeOffsetArray        LONG("offa") *)
  124.     OffsetArray* = RECORD
  125.         fNumOfOffsets*:            INTEGER;                                (* specify the size of the fOffset array *)
  126.         fOffset*:                ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF LONGINT;                (* when fNumOfOffsets > 1, the size of this array has to be calculated *)
  127.     END;
  128.  
  129.     OffsetArrayPtr* = POINTER TO OffsetArray;
  130.  
  131.     OffsetArrayHandle* = HANDLE TO OffsetArray (*ΔΔ POINTER TO OffsetArrayPtr*);
  132.  
  133.     TSMDocumentID* = Types.Ptr;
  134.  
  135.     InterfaceTypeList* = ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF Types.OSType;
  136.  
  137. (* Text Service Info List *)
  138.     TextServiceInfo* = RECORD
  139.         fComponent*:                Components.Component;
  140.         fItemName*:                Types.Str255;
  141.     END;
  142.  
  143.     TextServiceInfoPtr* = POINTER TO TextServiceInfo;
  144.  
  145.     TextServiceList* = RECORD
  146.         fTextServiceCount*:        INTEGER;                                (* number of entries in the 'fServices' array *)
  147.         fServices*:                ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF TextServiceInfo;        (* Note: array of 'TextServiceInfo' records follows *)
  148.     END;
  149.  
  150.     TextServiceListPtr* = POINTER TO TextServiceList;
  151.  
  152.     TextServiceListHandle* = HANDLE TO TextServiceList (*ΔΔ POINTER TO TextServiceListPtr*);
  153.  
  154.     ScriptLanguageRecord* = RECORD
  155.         fScript*:                Types.ScriptCode;
  156.         fLanguage*:                Types.LangCode;
  157.     END;
  158.  
  159.     ScriptLanguageSupport* = RECORD
  160.         fScriptLanguageCount*:    INTEGER;                                (* number of entries in the 'fScriptLanguageArray' array *)
  161.         fScriptLanguageArray*:    ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF ScriptLanguageRecord;    (* Note: array of 'ScriptLanguageRecord' records follows *)
  162.     END;
  163.  
  164.     ScriptLanguageSupportPtr* = POINTER TO ScriptLanguageSupport;
  165.  
  166.     ScriptLanguageSupportHandle* = HANDLE TO ScriptLanguageSupport (*ΔΔ POINTER TO ScriptLanguageSupportPtr*);
  167.  
  168.  
  169. CONST
  170. (* Low level routines which are dispatched directly to the Components.Component Manager *)
  171.     kCMGetScriptLangSupport*        = $0001;                        (* Components.Component Manager call selector 1 *)
  172.     kCMInitiateTextService*        = $0002;                        (* Components.Component Manager call selector 2 *)
  173.     kCMTerminateTextService*        = $0003;                        (* Components.Component Manager call selector 3 *)
  174.     kCMActivateTextService*        = $0004;                        (* Components.Component Manager call selector 4 *)
  175.     kCMDeactivateTextService*    = $0005;                        (* Components.Component Manager call selector 5 *)
  176.     kCMTextServiceEvent*            = $0006;                        (* Components.Component Manager call selector 6 *)
  177.     kCMGetTextServiceMenu*        = $0007;                        (* Components.Component Manager call selector 7 *)
  178.     kCMTextServiceMenuSelect*    = $0008;                        (* Components.Component Manager call selector 8 *)
  179.     kCMFixTextService*            = $0009;                        (* Components.Component Manager call selector 9 *)
  180.     kCMSetTextServiceCursor*        = $000A;                        (* Components.Component Manager call selector 10 *)
  181.     kCMHidePaletteWindows*        = $000B;                        (* Components.Component Manager call selector 11 *)
  182.  
  183. (* High level TSM routines *)
  184.  
  185. PROCEDURE NewTSMDocument*(numOfInterface: INTEGER; VAR supportedInterfaceTypes: InterfaceTypeList; VAR idocID: TSMDocumentID; refcon: LONGINT): Types.OSErr;
  186.     (*$IF NOT GENERATINGCFM*)
  187.     INLINE PASCAL $7000, $AA54;
  188.     (*$END*)
  189. PROCEDURE DeleteTSMDocument*(idocID: TSMDocumentID): Types.OSErr;
  190.     (*$IF NOT GENERATINGCFM*)
  191.     INLINE PASCAL $7001, $AA54;
  192.     (*$END*)
  193. PROCEDURE ActivateTSMDocument*(idocID: TSMDocumentID): Types.OSErr;
  194.     (*$IF NOT GENERATINGCFM*)
  195.     INLINE PASCAL $7002, $AA54;
  196.     (*$END*)
  197. PROCEDURE DeactivateTSMDocument*(idocID: TSMDocumentID): Types.OSErr;
  198.     (*$IF NOT GENERATINGCFM*)
  199.     INLINE PASCAL $7003, $AA54;
  200.     (*$END*)
  201. PROCEDURE TSMEvent*(VAR event: Events.EventRecord): BOOLEAN;
  202.     (*$IF NOT GENERATINGCFM*)
  203.     INLINE PASCAL $7004, $AA54;
  204.     (*$END*)
  205. PROCEDURE TSMMenuSelect*(menuResult: LONGINT): BOOLEAN;
  206.     (*$IF NOT GENERATINGCFM*)
  207.     INLINE PASCAL $7005, $AA54;
  208.     (*$END*)
  209. PROCEDURE SetTSMCursor*(mousePos: Types.Point): BOOLEAN;
  210.     (*$IF NOT GENERATINGCFM*)
  211.     INLINE PASCAL $7006, $AA54;
  212.     (*$END*)
  213. PROCEDURE FixTSMDocument*(idocID: TSMDocumentID): Types.OSErr;
  214.     (*$IF NOT GENERATINGCFM*)
  215.     INLINE PASCAL $7007, $AA54;
  216.     (*$END*)
  217. PROCEDURE GetServiceList*(numOfInterface: INTEGER; VAR supportedInterfaceTypes: Types.OSType; VAR serviceInfo: TextServiceListHandle; VAR seedValue: LONGINT): Types.OSErr;
  218.     (*$IF NOT GENERATINGCFM*)
  219.     INLINE PASCAL $7008, $AA54;
  220.     (*$END*)
  221. PROCEDURE OpenTextService*(idocID: TSMDocumentID; aComponent: Components.Component; VAR aComponentInstance: Components.ComponentInstance): Types.OSErr;
  222.     (*$IF NOT GENERATINGCFM*)
  223.     INLINE PASCAL $7009, $AA54;
  224.     (*$END*)
  225. PROCEDURE CloseTextService*(idocID: TSMDocumentID; aComponentInstance: Components.ComponentInstance): Types.OSErr;
  226.     (*$IF NOT GENERATINGCFM*)
  227.     INLINE PASCAL $700A, $AA54;
  228.     (*$END*)
  229. PROCEDURE SendAEFromTSMComponent*((*CONST*)VAR theAppleEvent: AppleEvents.AppleEvent; VAR reply: AppleEvents.AppleEvent; sendMode: AppleEvents.AESendMode; sendPriority: AppleEvents.AESendPriority; timeOutInTicks: LONGINT; idleProc: AppleEvents.AEIdleUPP; filterProc: AppleEvents.AEFilterUPP): Types.OSErr;
  230.     (*$IF NOT GENERATINGCFM*)
  231.     INLINE PASCAL $700B, $AA54;
  232.     (*$END*)
  233. PROCEDURE InitTSMAwareApplication*(): Types.OSErr;
  234.     (*$IF NOT GENERATINGCFM*)
  235.     INLINE PASCAL $7014, $AA54;
  236.     (*$END*)
  237. PROCEDURE CloseTSMAwareApplication*(): Types.OSErr;
  238.     (*$IF NOT GENERATINGCFM*)
  239.     INLINE PASCAL $7015, $AA54;
  240.     (*$END*)
  241. (* Utilities *)
  242. PROCEDURE SetDefaultInputMethod*(ts: Components.Component; VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr;
  243.     (*$IF NOT GENERATINGCFM*)
  244.     INLINE PASCAL $700C, $AA54;
  245.     (*$END*)
  246. PROCEDURE GetDefaultInputMethod*(VAR ts: Components.Component; VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr;
  247.     (*$IF NOT GENERATINGCFM*)
  248.     INLINE PASCAL $700D, $AA54;
  249.     (*$END*)
  250. PROCEDURE SetTextServiceLanguage*(VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr;
  251.     (*$IF NOT GENERATINGCFM*)
  252.     INLINE PASCAL $700E, $AA54;
  253.     (*$END*)
  254. PROCEDURE GetTextServiceLanguage*(VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr;
  255.     (*$IF NOT GENERATINGCFM*)
  256.     INLINE PASCAL $700F, $AA54;
  257.     (*$END*)
  258. PROCEDURE UseInputWindow*(idocID: TSMDocumentID; useWindow: BOOLEAN): Types.OSErr;
  259.     (*$IF NOT GENERATINGCFM*)
  260.     INLINE PASCAL $7010, $AA54;
  261.     (*$END*)
  262. PROCEDURE NewServiceWindow*(wStorage: (*ΔΔUNIVΔΔ*) Types.Ptr; (*CONST*)VAR boundsRect: Types.Rect; title: Types.ConstStr255Param; visible: BOOLEAN; theProc: INTEGER; behind: Quickdraw.WindowPtr; goAwayFlag: BOOLEAN; ts: Components.ComponentInstance; 
  263. VAR window: Quickdraw.WindowPtr): Types.OSErr;
  264.     (*$IF NOT GENERATINGCFM*)
  265.     INLINE PASCAL $7011, $AA54;
  266.     (*$END*)
  267. PROCEDURE CloseServiceWindow*(window: Quickdraw.WindowPtr): Types.OSErr;
  268.     (*$IF NOT GENERATINGCFM*)
  269.     INLINE PASCAL $7012, $AA54;
  270.     (*$END*)
  271. PROCEDURE GetFrontServiceWindow*(VAR window: Quickdraw.WindowPtr): Types.OSErr;
  272.     (*$IF NOT GENERATINGCFM*)
  273.     INLINE PASCAL $7013, $AA54;
  274.     (*$END*)
  275. PROCEDURE FindServiceWindow*(thePoint: Types.Point; VAR theWindow: Quickdraw.WindowPtr): INTEGER;
  276.     (*$IF NOT GENERATINGCFM*)
  277.     INLINE PASCAL $7017, $AA54;
  278.     (*$END*)
  279. (* Low level TSM routines *)
  280. PROCEDURE GetScriptLanguageSupport*(ts: Components.ComponentInstance; VAR scriptHdl: ScriptLanguageSupportHandle): Components.ComponentResult;
  281.     (*$IF NOT GENERATINGCFM*)
  282.     INLINE PASCAL $2F3C, $04, $0001, $7000, $A82A;
  283.     (*$END*)
  284. PROCEDURE InitiateTextService*(ts: Components.ComponentInstance): Components.ComponentResult;
  285.     (*$IF NOT GENERATINGCFM*)
  286.     INLINE PASCAL $2F3C, $00, $0002, $7000, $A82A;
  287.     (*$END*)
  288. PROCEDURE TerminateTextService*(ts: Components.ComponentInstance): Components.ComponentResult;
  289.     (*$IF NOT GENERATINGCFM*)
  290.     INLINE PASCAL $2F3C, $00, $0003, $7000, $A82A;
  291.     (*$END*)
  292. PROCEDURE ActivateTextService*(ts: Components.ComponentInstance): Components.ComponentResult;
  293.     (*$IF NOT GENERATINGCFM*)
  294.     INLINE PASCAL $2F3C, $00, $0004, $7000, $A82A;
  295.     (*$END*)
  296. PROCEDURE DeactivateTextService*(ts: Components.ComponentInstance): Components.ComponentResult;
  297.     (*$IF NOT GENERATINGCFM*)
  298.     INLINE PASCAL $2F3C, $00, $0005, $7000, $A82A;
  299.     (*$END*)
  300. PROCEDURE TextServiceEvent*(ts: Components.ComponentInstance; numOfEvents: INTEGER; VAR event: Events.EventRecord): Components.ComponentResult;
  301.     (*$IF NOT GENERATINGCFM*)
  302.     INLINE PASCAL $2F3C, $06, $0006, $7000, $A82A;
  303.     (*$END*)
  304. PROCEDURE GetTextServiceMenu*(ts: Components.ComponentInstance; VAR serviceMenu: Menus.MenuHandle): Components.ComponentResult;
  305.     (*$IF NOT GENERATINGCFM*)
  306.     INLINE PASCAL $2F3C, $4, $0007, $7000, $A82A;
  307.     (*$END*)
  308. PROCEDURE TextServiceMenuSelect*(ts: Components.ComponentInstance; serviceMenu: Menus.MenuHandle; item: INTEGER): Components.ComponentResult;
  309.     (*$IF NOT GENERATINGCFM*)
  310.     INLINE PASCAL $2F3C, $06, $0008, $7000, $A82A;
  311.     (*$END*)
  312. PROCEDURE FixTextService*(ts: Components.ComponentInstance): Components.ComponentResult;
  313.     (*$IF NOT GENERATINGCFM*)
  314.     INLINE PASCAL $2F3C, $00, $0009, $7000, $A82A;
  315.     (*$END*)
  316. PROCEDURE SetTextServiceCursor*(ts: Components.ComponentInstance; mousePos: Types.Point): Components.ComponentResult;
  317.     (*$IF NOT GENERATINGCFM*)
  318.     INLINE PASCAL $2F3C, $04, $000A, $7000, $A82A;
  319.     (*$END*)
  320. PROCEDURE HidePaletteWindows*(ts: Components.ComponentInstance): Components.ComponentResult;
  321.     (*$IF NOT GENERATINGCFM*)
  322.     INLINE PASCAL $2F3C, $00, $000B, $7000, $A82A;
  323.     (*$END*)
  324.  
  325. (* $ALIGN RESET*)
  326. (* $POP*)
  327.  
  328.  END TextServices.
  329.